import 'package:equatable/equatable.dart';
import 'package:mobile_app.core/core/domain/entities/premium_access_status.dart';
import 'package:mobile_app.home.learning/learning_page/domain/helpers/should_show_premium_features/helper.dart';

part 'result.dart';

abstract class HandlePremiumAccessStatusOuterUpdate {
  PremiumAccessStatusOuterUpdateHandlingResult call({
    required PremiumAccessStatus premiumAccessStatus,
  });
}

class HandlePremiumAccessStatusOuterUpdateImpl implements HandlePremiumAccessStatusOuterUpdate {
  const HandlePremiumAccessStatusOuterUpdateImpl({
    required ShouldShowPremiumFeatures shouldShowPremiumFeatures,
  }) : _shouldShowPremiumFeatures = shouldShowPremiumFeatures;

  final ShouldShowPremiumFeatures _shouldShowPremiumFeatures;

  @override
  PremiumAccessStatusOuterUpdateHandlingResult call({
    required PremiumAccessStatus premiumAccessStatus,
  }) {
    final showPremiumFeatures = _shouldShowPremiumFeatures(
      premiumAccessStatus: premiumAccessStatus,
    );

    final result = PremiumAccessStatusOuterUpdateHandlingResult(
      showPremiumFeatures: showPremiumFeatures,
    );

    return result;
  }
}
